<template>
  <div>
    <el-dialog
      :show-close="false"
      :draggable="false"
      :model-value="show"
      :close-on-click-modal="false"
      class="cust-dialog"
      :top="top"
      :width="width"
      style="padding-bottom: 15px"
    >
      <template #header="{ titleId, titleClass }">
        <!-- <div class="my-header">123</div> -->
        <!-- 123 -->
        <div class="my-header">
          {{ title }}
        </div>
      </template>
      <div class="dialog-body">
        <slot></slot>
      </div>
      <div class="dialog-footer">
        <template v-if="(buttons && buttons.length > 0) || showCancel">
          <el-button link @click="close" v-if="showCancel">取消</el-button>
          <el-button
            v-for="btn in buttons"
            :type="btn.type"
            @click="btn.click"
            size="default"
            :key="btn.text"
            >{{ btn.text }}</el-button
          >
        </template>
      </div>
    </el-dialog>
  </div>
</template>

<script setup>
const props = defineProps({
  title: {
    type: String,
  },
  show: {
    type: Boolean,
    default: false,
  },
  showClose: {
    type: Boolean,
    default: true,
  },
  showCancel: {
    type: Boolean,
    default: true,
  },
  top: {
    type: String,
    default: "50px",
  },
  width: {
    type: String,
    default: "30%",
  },
  buttons: {
    type: Array,
  },
});

const emit = defineEmits();
const close = () => {
  //   props.show = false;
  emit("close");
};
</script>

<style lang="scss" scoped>
.el-dialog__body {
  .dialog-body {
    // padding: 100px;
    padding-top: 15px;
    border-top: 1px solid #7b3a3a;
    min-height: 100px;
    // height: 80px;
  }
  .dialog-footer {
    text-align: center;
  }
}
</style>
